from rest_framework import serializers
from .models import Message


# 管理端序列化器
class MessageSerializer(serializers.ModelSerializer):
    class Meta:
        model = Message
        fields = ['id', 'name', 'content', 'created_at', 'status']
        read_only_fields = ['id', 'created_at']


# 博客端序列化器
class BlogMessageSerializer(serializers.ModelSerializer):
    class Meta:
        model = Message
        fields = ['id', 'name', 'content', 'created_at']
        read_only_fields = ['id', 'created_at']
